package com.icss.OA.common;

public class R<T> {
    private String code;
    private String message;
    private T data;

    public static R success(String message) {
        R r = new R();
        r.setCode("50000");
        r.setMessage(message);
        return r;
    }


    public static R success(Object o) {
        R r = new R();
        r.setCode("50000");
        r.setData(o);
        return r;
    }
    public static R fail(String message) {
        R r = new R();
        r.setCode("50001");
        r.setMessage(message);
        return r;
    }

    public static R fail(ServiceException e) {
        R r = new R();
        r.setMessage(e.getMessage());
        return r;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }



}
